@crestapps/ai-chat-ui 2.0.0-preview.260 → 2.0.0-preview.263

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ai-chat.js CHANGED
@@ -2800,6 +2800,7 @@
2800
2800
  },
2801
2801
  template: config.messageTemplate
2802
2802
  };
2803
+ window.CoreAIChatSurface.registerRoot(document.querySelector(config.appElementSelector));
2803
2804
  const app = Vue.createApp(appDefinition).mount(config.appElementSelector);
2804
2805
  if (widgetBehavior && typeof widgetBehavior.attach === "function") widgetBehavior.attach(app, config);
2805
2806
  return app;
@@ -2892,8 +2893,11 @@
2892
2893
  }
2893
2894
  function scanForAutoInitialization(root) {
2894
2895
  if (!root || typeof root.querySelectorAll !== "function") return;
2895
- if (typeof root.matches === "function" && root.matches(autoInitializeSelector)) initializeFromElement(root);
2896
- root.querySelectorAll(autoInitializeSelector).forEach(initializeFromElement);
2896
+ const isPageMarkup = (element) => !window.CoreAIChatSurface.isInsideRenderedMessage(element);
2897
+ if (typeof root.matches === "function" && root.matches(autoInitializeSelector) && isPageMarkup(root)) initializeFromElement(root);
2898
+ root.querySelectorAll(autoInitializeSelector).forEach((element) => {
2899
+ if (isPageMarkup(element)) initializeFromElement(element);
2900
+ });
2897
2901
  }
2898
2902
  function startAutoInitialization() {
2899
2903
  scanForAutoInitialization(document);